package com.lds.erp.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dph.common.utils.utils.AppUtils;
import com.lds.erp.base.JsonResult;
import com.lds.erp.base.address.BsAddressFacade;
import com.lds.erp.base.address.order.BsAddressTreeQueryOrder;
import com.lds.erp.base.address.result.BsAddressTreeQueryResult;
import com.lds.erp.util.JsonUtils;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author yyc
 * @apiNote
 * @createTime 2019/12/19
 */
@RequestMapping("/api/common/base")
@RestController
@Api(value = "基础业务接口", tags = {"基础业务"})
public class BaseController {

    private static final Logger log = LoggerFactory.getLogger(BaseController.class);

    @Reference(version = "1.0")
    private BsAddressFacade bsAddressFacade;

    @GetMapping("bsAddressTreeQuery")
    @ApiOperation(value = "获取地区级联列表(senilon)", notes = "获取地区级联列表")
    public JsonResult getPartnerList(){
        BsAddressTreeQueryOrder order = new BsAddressTreeQueryOrder();;
        order.setSerialNo(AppUtils.newNo());

        BsAddressTreeQueryResult result = bsAddressFacade.bsAddressTreeQuery(order);
        return result.isSuccess() ? JsonUtils.success(result) : JsonUtils.fail(result.getMessage());
    }

}
